package com.huajin.codetest.lock;

/**
 * 以下代码是否线程安全
 */
public class VolatileTest2 {
	
	private static volatile int count = 10000;
	
	public static void main(String[] args) throws InterruptedException {
		for (int i = 0; i < 10000; i++) {
			new Thread(() -> count--).start();
		}
		Thread.sleep(2000);
		System.out.println(count);
	}

}
